<?php

use yii\db\Migration;

/**
 * Class m191111_070209_notice
 */
class m191111_070209_notice extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="会员消息记录表"';
        $this->createTable('{{%notice}}', [
            'id' => $this->primaryKey(),
            'member_id' => $this->Integer()->notNull()->comment('获取消息用户id'),
            'at_member_id' => $this->Integer()->notNull()->comment('发起相关操作用户id'),
            'posts_id' => $this->Integer()->notNull()->comment('帖子的id'),
            'type' => $this->smallInteger()->notNull()->comment('消息类型  1：用户评论消息 2：系统回复当前用户评论消息 3：系统回复当前用户发帖消息'),
            'comment'=>$this->text()->notNull()->comment('评论信息'),
            'status' => $this->smallInteger()->notNull()->defaultValue(1)->comment('查看状态  1：未查看 2：已查看 3：已删除'),
            'created_at' => $this->integer()->notNull(),
            'updated_at' => $this->integer(),
            'deleted_at' => $this->integer(),
        ],$tableOptions);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('{{%notice}}');
        return false;
    }

}
